<%@page import="fr.greta.centreFormation.bean.Candidat"%>
<%@page import="fr.greta.centreFormation.bean.Promotion"%>
<%@page import="fr.greta.centreFormation.bean.Module"%>
<%@page import="fr.greta.centreFormation.bean.UniteEnseignement"%>
<%@page import="fr.greta.centreFormation.bean.Cursus"%>
<%@ page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<jsp:useBean id="lesPromotions" class="java.util.ArrayList"
	scope="session"></jsp:useBean>
<%
	String etat = (String) session.getAttribute("etat");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" media="screen" type="text/css"
	href="css/generalStyle.css">
<link rel="stylesheet" media="screen" type="text/css"
	href="css/adminStyle.css">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<title>Insert title here</title>
</head>
<body>
	<div class="aur-content">
		<div class="row">
			<jsp:include page="navAdmin.jsp"></jsp:include>
				<div class="hero-unit">
					<h1>Les Promotion</h1>
					<a class="btn btn-primary aur-button-tittle"
						href="AjouterPromotion">Ajouter une promotion</a>
				</div>
				<%
					if (etat != null) {
						out.println("<div class='etat alert alert-error'>" + etat
								+ "</div>");
					}
				%>
				<table class="table table-striped">
					<tr>
						<th>id</th>
						<th>Date Debut</th>
						<th>Date Fin</th>
						<th>Cursus</th>
						<th>Candidat</th>
						<th>Action</th>
					</tr>

					<%
						for (Promotion unePromotion : (ArrayList<Promotion>) lesPromotions) {
							out.println("<tr>");
							out.println("<td class='idTable'>"
									+ unePromotion.getIdPromotion() + "</td>");
							out.println("<td class='dateTable' >"
									+ unePromotion.getDebutPromotion() + "</td>");
							out.println("<td class='dateTable'>"
									+ unePromotion.getFinPromotion() + "</td>");
							out.println("<td class='motTable'>"
									+ unePromotion.getCursus().getIntituleCursus()
									+ "</td>");
							out.println("<td class='uniteTable'>");
							out.println("<ul>");
							for (Candidat c : unePromotion.getAllCandidats()) {
								out.println("<li>" + c.getNom() + " " + c.getPrenom()
										+ "</li>");
							}
							out.println("</ul>");
							out.println("</td>");
							out.println("<td>");
							out.println("<a class='btn' href='ModifierPromotion?promotion="
									+ unePromotion.getIdPromotion() + "'>Modifier</a>");
							out.println("</td>");
							out.println("</tr>");
						}
					%>
				</table>
			</div>
			<jsp:include page="footer.html"></jsp:include>
		</div>
</body>
</html>